Network Port
The network port allows you to send data to other network ports.
Functions
getAntenna
NetworkPort.getAntenna()
Gets the connected antenna.
Returns:
- [ AntennaComponent?] The antenna if it is connected, else nil.
hasConnection
NetworkPort.hasConnection()
Returns true if there's a connection.
Returns:
- [ boolean ] True if it has a connection.
sendPacket
NetworkPort.sendPacket( data )
Sends a packet to an Antenna or Network Port (If multiple antennas are connected, the packet will be sent through the first discovered antenna).
Arguments:
- data [ any ] The contents of the packet. Doesn't matter what the data is. can be a number or even a function!
sendPacketToAntenna
NetworkPort.sendPacketToAntenna( name, data )
Sends a packet to a specified antenna. (An antenna needs to be connected!)
Arguments:
- name [ string ] The antenna name.
- data [ any ] The contents of the packet. Doesn't matter what the data is. can be a number or even a function!
getTotalPackets
NetworkPort.getTotalPackets()
Gets the total unread packets that have been sent to the network port.
Returns:
- [ integer ] The total packets.
receivePacket
NetworkPort.receivePacket()
Reads a packet
Check if there are any packets first!
Please check if there are any packets! If there are none and you execute this, It will error!
Returns:
- [ any ] The content of the packet.
clearPackets
NetworkPort.clearPackets()
Clears all unread packets.